<template>
  <el-button type="danger" :loading="loading" @click="cancelRow">{{$t('middle.取消重新入库')}}</el-button>
</template>

<script>
import {deleteCancelWork} from "@/api/middleWork";

export default {
  name: "ReturnCancelButton",
  props:{
    id:{
      type: Number,
      required: true,
    },
  },
  data(){
    return {
      loading: false,
    }
  },
  methods:{
    cancelRow(){
      this.$warning( '',{
        title: this.$t('middle.确认取消重新入库？'),
      })
        .then(()=>{
          this.loading = true
          deleteCancelWork(this.id)
            .then(res=>{
              this.$successMessage(res.message)
              this.$emit('changeWorkStatus',this.id)
            })
          this.loading = false
        })
        .catch(()=>{

        })
    }
  }
}
</script>

<style scoped>

</style>
